package com.ubxtech.i18n.support;

import com.alibaba.nacos.api.config.listener.Listener;

import java.util.Locale;
import java.util.concurrent.Executor;

/**
 * 动态配置配置
 * @author Victor.Xiao
 * @since 2023-12-18 20:50
 **/
public class NacosI18nConfigListener implements Listener {
    protected NacosStaticMessageSource nacosStaticMessageSource;
    protected Locale locale;
    public NacosI18nConfigListener(NacosStaticMessageSource nacosStaticMessageSource, Locale locale) {
        this.nacosStaticMessageSource = nacosStaticMessageSource;
        this.locale = locale;
    }
    @Override
    public Executor getExecutor() {
        return null;
    }

    @Override
    public void receiveConfigInfo(String configInfo) {
        nacosStaticMessageSource.initMessageCodeByConfig(configInfo, locale);
    }
}
